const mysql = require('mysql2');

// 创建数据库链接
const connection = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: 'mysql_password',
  database: 'cms',
})
connection.connect(function(err) {
  // 如果err有值链接失败
  if(err){
    console.error('error connecting'+err.stack);
  }
  console.log('Connected successfully.');
})
